import 'package:flutter/material.dart';
import 'package:xinxuan/common/network_image_util.dart';
import 'package:xinxuan/utils/color_util.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:xinxuan/vo/seckill_order_detail_vo.dart';

class SeckillOrderDetailGoodsArr extends StatelessWidget {

  final SeckillOrderDetailData seckillOrderDetailData;
  SeckillOrderDetailGoodsArr({
    required this.seckillOrderDetailData
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      color: bgWhiteColor,
      padding: EdgeInsets.symmetric(horizontal: 16.w),
      child: Column(
        children: [
          Container(
            height: 45.h,
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  '商品信息',
                  style: TextStyle(
                    color: textBlackColor,
                    fontSize: 16.sp,
                    fontWeight: FontWeight.bold
                  ),
                ),
                Text(
                  '${seckillOrderDetailData.statusStr == null ? '' : seckillOrderDetailData.statusStr}',
                  style: TextStyle(
                    color: mainTextColor,
                    fontSize: 14.sp
                  ),
                )
              ],
            ),
          ),
          Column(
            children: seckillOrderDetailData.products!.map((item) {
              return Container(
                margin: EdgeInsets.only(bottom: 12.h),
                child: Row(
                  children: [
                    NetworkImageUtil(
                      url: item.image ?? '', 
                      width: 90.w, 
                      height: 90.w,
                      borderRadius: 5.w,
                    ),
                    SizedBox(width: 12.w),
                    Expanded(child: Container(
                      constraints: BoxConstraints(
                        minHeight: 90.w
                      ),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text(
                            '${item.title}',
                            overflow: TextOverflow.ellipsis,
                            maxLines: 2,
                            style: TextStyle(
                              color: textBlackColor,
                              fontSize: 14.sp
                            )
                          ),
                          SizedBox(height: 6.w),
                          Text.rich(
                            TextSpan(
                              text: '¥',
                              style: TextStyle(
                                color: mainTextColor,
                                fontSize: 14.sp,
                                fontWeight: FontWeight.bold
                              ),
                              children: [
                                TextSpan(
                                  text: '${item.price}',
                                  style: TextStyle(
                                    color: mainTextColor,
                                    fontSize: 18.sp,
                                    fontWeight: FontWeight.bold
                                  )
                                )
                              ]
                            )
                          )
                        ],
                      ),
                    ))
                  ],
                ),
              );
            }).toList(),
          )
        ],
      ),
    );
  }
}